package HibernateUtils;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;

import Beans.*;
public class HibernateUtil
{
    private static final SessionFactory sessionFactory;
    static
    {
        try
        {
        	 AnnotationConfiguration config = new AnnotationConfiguration();
             config.addAnnotatedClass(EmpleadoBean.class);
             config.addAnnotatedClass(AdministrativoBean.class);
             config.addAnnotatedClass(MozoBean.class);
             config.addAnnotatedClass(EncargadoBean.class);
             config.addAnnotatedClass(RecetaBean.class);
             config.addAnnotatedClass(IngredienteBean.class);
             config.addAnnotatedClass(ItemRecetaBean.class);
             config.addAnnotatedClass(InsumoBean.class);
             config.addAnnotatedClass(ProductoBean.class);
             config.addAnnotatedClass(SimpleBean.class);
             config.addAnnotatedClass(SemielaboradoBean.class);
             config.addAnnotatedClass(MesaBean.class);
             config.addAnnotatedClass(SalonBean.class);
             config.addAnnotatedClass(ReservaBean.class);
             config.addAnnotatedClass(SectorBean.class);
             config.addAnnotatedClass(MozoBean.class);
             config.addAnnotatedClass(ComandaBean.class);
             config.addAnnotatedClass(itemComandaBean.class);
             config.addAnnotatedClass(PlatoBean.class);
             config.addAnnotatedClass(RubroBean.class);
             config.addAnnotatedClass(CartaBean.class);
             config.addAnnotatedClass(ProovedorBean.class);	
             config.addAnnotatedClass(ItemProovedorBean.class);
             config.addAnnotatedClass(AreaBean.class);   
             config.addAnnotatedClass(DepositoBean.class); 
             config.addAnnotatedClass(DepositoCentralBean.class); 
             config.addAnnotatedClass(ItemStockBean.class);
             config.addAnnotatedClass(LoteBean.class);
             config.addAnnotatedClass(SucursalBean.class);
             config.addAnnotatedClass(ComisionBean.class);
             config.addAnnotatedClass(VentaBean.class);
             config.addAnnotatedClass(CajaBean.class);
             config.addAnnotatedClass(CajaDiariaBean.class);
             config.addAnnotatedClass(PagoBean.class);    
             config.addAnnotatedClass(ItemBilleteBean.class);
             config.addAnnotatedClass(BilleteBean.class);
             config.addAnnotatedClass(FacturaBean.class);
             config.addAnnotatedClass(ItemFacturaBean.class);
             config.addAnnotatedClass(TicketBean.class);	
             config.addAnnotatedClass(ItemVentaBean.class);
             config.addAnnotatedClass(MovimientoBean.class);
             config.addAnnotatedClass(ListaReposicionBean.class);
             config.addAnnotatedClass(ItemReposicionBean.class);
             config.addAnnotatedClass(AdministracionBean.class); 
             config.addAnnotatedClass(NotaDevolucionBean.class); 
             config.addAnnotatedClass(ProovedorBean.class);
             config.addAnnotatedClass(ItemProovedorBean.class); 
             config.addAnnotatedClass(OrdenCompraBean.class); 
             config.addAnnotatedClass(ItemOCBean.class);
             config.addAnnotatedClass(PlanProduccionBean.class);
             config.addAnnotatedClass(ItemPlanProduccionBean.class);
             
             sessionFactory = config.buildSessionFactory();
        }
        catch (Throwable ex)
        {
            System.err.println("Initial SessionFactory creation failed." + ex);
            throw new ExceptionInInitializerError(ex);
        }
    }
 
    public static SessionFactory getSessionFactory()
    {
        return sessionFactory;
    }
}
